<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/admincontent.jsp" %>
<div id="Content">
    <form id="modelform" method="post" action="/schooluser/EditAction">
<%--        <div class="btnbar">
            <button type="submit" class="save">保 存</button>
        </div>--%>
    <div class="toolbars">
        <a id="save">
            <em class="ico16 save_traft_16"></em>
            <span class="menu_span" title="保存">保存</span>
        </a>
    </div>
        <input type="hidden" name="id" datatype="*" nullmsg="非法访问" value="${user.id}"/>
        <table class="treeTable inputform" style="margin-top: 10px">
            <tbody>
            <tr>
                <td width="80">登录账号：</td>
                <td>${user.ucode}</td>
            </tr>
            <tr>
                <td>学校名称：</td>
                <td>${user.uname}</td>
            </tr>
            <tr>
                <td>联系方式：</td>
                <td><input type="text" name="utel" value="${user.utel}"/></td>
            </tr>
            <tr>
                <td colspan="2">
                    <div class="radio">
                        <span rel="0" class="checked">不修改密码</span>
                        <span rel="1">需要修改密码</span>
                        <input type="hidden" name="pwd" value="0">
                    </div>
                </td>
            </tr>
            <tr id="pwd" style="display:none;">
                <td>登录密码：</td>
                <td><input type="password" name="upwd"/></td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#save").click(function () {
            var data = {};
            data["id"] = $("input[name='id']").val();
            data["utel"] = $("input[name='utel']").val();
            data["pwd"] = $("input[name='pwd']").val();
            data["upwd"] = $("input[name='upwd']").val();
            $.ajax({
                url: "/schooluser/EditAction",
                type: 'POST',
                data: data,
                success: function (data) {
                    layer.msg(data.Message, {icon: 1, time: 2000});
                    setTimeout(()=>{
                        parent.location.reload();
                    }, 2000);

                },
                error: function (data) {
                    layer.msg(data.Message, {icon: 2, time: 2000});
                }
            });
        });
    });
    $(function () {
        $('.radio span').click(function () {
            if ($(this).attr('rel') == "1")
                $('#pwd').show();
            else
                $('#pwd').hide();
        });
    });
</script>
</body>
</html>